{% extends 'shop/base.html' %}

{% block title%}
    商品修改页
{% endblock %}

{% block content %}
<form method="post" enctype="multipart/form-data">
   {% csrf_token %}
   {% ifequal id 0 %}
       <p>
           <input class="form-control form-control-user" type="text" name="name" placeholder="商品名称">
       </p>
       <p>
           <input class="form-control form-control-user" type="number" name="price" placeholder="价格">
       </p>
       <p>
           <input class="form-control form-control-user" type="number" name="number" placeholder="商品数量">
       </p>
       <p>
           <input class="form-control form-control-user" type="datetime-local" name="production" placeholder="商品c出厂日期">
       </p>
       <p>
           <input class="form-control form-control-user" type="text" name="safe_date" placeholder="保质期">
       </p>
       <p>
           <textarea id="description" class="form-control form-control-user" name="description">

           </textarea>
       </p>
       <p>
           <input class="form-control form-control-user" type="file" name="picture" placeholder="商品图片">
       </p>

       <p>
           <input class="btn btn-primary btn-block" type="submit" value="添加商品">
       </p>
    {% else %}
       <p>
           <input class="form-control form-control-user" type="text" name="name" placeholder="商品名称" value="{{ goods_data.name }}">
       </p>
       <p>
           <input class="form-control form-control-user" type="number" name="price" placeholder="价格" value="{{ goods_data.price }}">
       </p>
       <p>
           <input class="form-control form-control-user" type="number" name="number" placeholder="商品数量" value="{{ goods_data.number }}">
       </p>
       <p>
           <input class="form-control form-control-user" type="text" name="production" placeholder="商品出厂日期" value="{{ goods_data.production }}">
       </p>
       <p>
           <input class="form-control form-control-user" type="text" name="safe_date" placeholder="保质期" value="{{ goods_data.safe_date }}">
       </p>
       <p>
           <textarea id="description" class="form-control form-control-user" name="description">
                {{ goods_data.description }}
           </textarea>
       </p>
       <p>
           <input class="form-control form-control-user" type="file" name="picture" placeholder="商品图片">
       </p>

       <p>
           <input class="btn btn-primary btn-block" type="submit" value="修改商品">
       </p>
    {% endifequal %}
</form>
{% endblock %}